<!DOCTYPE html>
<html lang="cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<!--头部导航栏-->
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow" th:fragment="topNavigationBar()">
    <!--个人界面-->
    <a class="navbar-brand col-md-3 col-lg-2 mr-0 px-3" th:href="@{/}">[[${session.admin.nickName}]]</a>
    <button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-toggle="collapse"
            data-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>
    <input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search"
           id="searchName" onchange="searchBlog()" th:value="${searchName}">
    <ul class="navbar-nav px-3">
        <li class="nav-item text-nowrap">
            <a class="nav-link" th:href="@{/admin/logout}">退出登录</a>
        </li>
    </ul>

</nav>


<!--左 侧边栏-->
<nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse" th:fragment="sidebar(action)">
    <div class="sidebar-sticky pt-3">
        <ul class="nav flex-column">
            <li class="nav-item">
                <a th:class="${action == 'admin' ? 'nav-link active' : 'nav-link'}" th:href="@{/admin}">
                    <span data-feather="home"></span>
                    首页 <th:block th:if="${action=='admin'}"><span class="sr-only">(current)</span></th:block>
                </a>
            </li>
            <li class="nav-item">
                <a th:class="${action == 'addBlog' ? 'nav-link active' : 'nav-link'}" th:href="@{/admin/{url}(url='addBlog')}">
                    <span data-feather="file"></span>
                    发布博客 <th:block th:if="${action=='addBlog'}"><span class="sr-only">(current)</span></th:block>
                </a>
            </li>
            <li class="nav-item">
                <a th:class="${action == 'listBlog' ? 'nav-link active' : 'nav-link'}" th:href="@{/admin/{url}(url='listBlog')}">
                    <span data-feather="shopping-cart"></span>
                    博客管理 <th:block th:if="${action=='listBlog'}"><span class="sr-only">(current)</span></th:block>
                </a>
            </li>
            <li class="nav-item">
                <a th:class="${action == 'recycleBin' ? 'nav-link active' : 'nav-link'}" th:href="@{/admin/{url}(url='recycleBin')}">
                    <span data-feather="layers"></span>
                    博客回收站 <th:block th:if="${action=='recycleBin'}"><span class="sr-only">(current)</span></th:block>
                </a>
            </li>
            <li class="nav-item">
                <a th:class="${action == 'listCategory' ? 'nav-link active' : 'nav-link'}" th:href="@{/admin/{url}(url='listCategory')}">
                    <span data-feather="bar-chart-2"></span>
                    分类管理 <th:block th:if="${action=='listCategory'}"><span class="sr-only">(current)</span></th:block>
                </a>
            </li>
            <li class="nav-item">
                <a th:class="${action == 'listComment' ? 'nav-link active' : 'nav-link'}" th:href="@{/admin/{url}(url='listComment')}">
                    <span data-feather="users"></span>
                    评论管理 <th:block th:if="${action=='listComment'}"><span class="sr-only">(current)</span></th:block>
                </a>
            </li>
        </ul>

    </div>
</nav>



<!--管理页面公共js-->
<th:block th:fragment="adminJs">
<script th:src="@{/js/jquery-3.5.1.min.js}"></script>
<script>window.jQuery || document.write('<script th:src="@{/js/jquery-3.5.1.min.js}"><\/script>')</script>
<script th:src="@{/js/bootstrap.bundle.min.js}"></script>
<script th:src="@{/js/feather.min.js}"></script>
<script th:src="@{/js/Chart.min.js}"></script>
<script th:src="@{/js/dashboard.js}"></script>
</th:block>


<script th:fragment="searchBlogJs()">
    function searchBlog() {
        let searchName = $("#searchName").val();
        console.log("/admin/[[${listItem?:'listBlog'}]]?current=1&searchName="+searchName);
        window.location.href = "/admin/[[${listItem?:'listBlog'}]]?current=1&searchName="+searchName;
    }
</script>
<!--搜索博客标题-->



</html>